package com.v2future.sjt.collegecheckingattendance.utils;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Tools {

	public static Object depthClone(Object srcObj){
		Object cloneObj = null;
		try { 
			ByteArrayOutputStream out = new ByteArrayOutputStream();
			ObjectOutputStream oo = new ObjectOutputStream(out);
			oo.writeObject(srcObj); 
		
			ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
			ObjectInputStream oi = new ObjectInputStream(in);
			cloneObj = oi.readObject(); 
			} catch (IOException e) {
				e.printStackTrace(); 
			} catch (ClassNotFoundException e) {
				e.printStackTrace(); 
			} 
		return cloneObj; 
	}
}
